package com.atguigu.statistics.schedule;

import com.atguigu.commonutils.Result;
import com.atguigu.statistics.controller.DailyController;
import com.atguigu.statistics.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class ScheduledTask {
    @Autowired
    DailyController dailyController;
    //定时任务  每隔五秒执行一次
    @Scheduled(cron = "0 0 1 * * ? ")
    public void task1(){
        dailyController.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(), -1)));
    }



}
